#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int diff (FILE * file1, FILE * file2)
{
	int i=1;
	char x[500],y[500];

	while (1) 
	{
		char * a = fgets(x,500,file1);
		char * b = fgets(y,500,file2);

		if ((a==NULL)&&(b==NULL))
			return 0;

		else if (a==NULL||b==NULL)
			return i;
		else
		{
			if(strcmp(x,y)!=0)
				return i;				
		}
		i++;
	}

}

int main ()
{
	int result;
	FILE *file1;
	FILE *file2;
	
	
	file1 = fopen ("filename1.txt", "r");
	file2 = fopen ("filename2.txt", "r");

	result = diff(file1, file2); 
	if (result == 0)
	{
		printf("Faili NE otlichautsya!\n");
	}
	else
	{
		printf("Faili otlichautsya v stroke: %d\n", result);
	}
	
	fclose(file1);
	fclose(file2);

	system ("PAUSE");
}
 


